// utils/sqlite/database/db.js  
// import {
// 	openDB
// } from '../sqlite.js'

// export const checkTableExists = async (tableName) => {
// 	console.log("ready open DB")
// 	// const db = await openDB() // 确保数据库连接已建立 
// 	// console.log("db===", db)
// 	return new Promise((resolve) => {
// 		plus.sqlite.selectSql({
// 			name: db.name,
// 			sql: `SELECT name FROM sqlite_master WHERE type='table' AND name=?`,
// 			success: (res) => resolve(res.length > 0),
// 			fail: () => resolve(false)
// 		})
// 	})
// }
/**
 * @name是数据库名称
 */
export const checkTableExists = async (name,tablename) => {
	console.log("ready open DB")
	// const db = await openDB() // 确保数据库连接已建立 
	// console.log("db===", db)
	return new Promise((resolve) => {
		plus.sqlite.selectSql({
			name: name,
			sql: `SELECT name FROM sqlite_master WHERE type='table' AND name=${tablename}`,
			success: (res) => resolve(res.length > 0),
			fail: () => resolve(false)
		})
	})
}